]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/SuperPolarity.cs
I think bullets come out now.
[rbdr/super-polarity] / Super Polarity / SuperPolarity.cs
index 40f147779419046afa82f9efe9ee23f226826168..21d1ed444af2f0cec8fcdfaa2e2c3d8005471fdc 100644 (file)
@@ -17,16 +17,20 @@ namespace SuperPolarity
     /// </summary>
     public class SuperPolarity : Game
     {
-        GraphicsDeviceManager graphics;
+        public static GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
 
-        MainShip player;
+        public static int OutlierBounds;
 
         public SuperPolarity()
             : base()
         {
-            graphics = new GraphicsDeviceManager(this);
+            SuperPolarity.graphics = new GraphicsDeviceManager(this);
+            SuperPolarity.graphics.PreferMultiSampling = true;
             Content.RootDirectory = "Content";
+            ActorFactory.SetGame(this);
+            ParticleEffectFactory.SetGame(this);
+            ActorManager.SetGame(this);
         }
 
         /// <summary>
@@ -37,9 +41,15 @@ namespace SuperPolarity
         /// </summary>
         protected override void Initialize()
         {
-            player = new MainShip();
-
             base.Initialize();
+
+            OutlierBounds = 100;
+
+            InputController.RegisterEventForButton("changePolarity", Buttons.A);
+            InputController.RegisterEventForKey("changePolarity", Keys.Z);
+
+            InputController.RegisterEventForButton("shoot", Buttons.X);
+            InputController.RegisterEventForKey("shoot", Keys.X);
         }
 
         /// <summary>
@@ -53,7 +63,9 @@ namespace SuperPolarity
 
             Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
 
-            player.Initialize(Content.Load<Texture2D>("Graphics\\player"), playerPosition);
+            Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition));
+            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200)));
+            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200)));
         }
 
         /// <summary>
@@ -77,6 +89,9 @@ namespace SuperPolarity
 
             // TODO: Add your update logic here
 
+            InputController.UpdateInput();
+            ActorManager.Update(gameTime);
+
             base.Update(gameTime);
         }
 
@@ -86,11 +101,11 @@ namespace SuperPolarity
         /// <param name="gameTime">Provides a snapshot of timing values.</param>
         protected override void Draw(GameTime gameTime)
         {
-            GraphicsDevice.Clear(Color.CornflowerBlue);
+            GraphicsDevice.Clear(Color.White);
 
             spriteBatch.Begin();
 
-            player.Draw(spriteBatch);
+            Renderer.Draw(spriteBatch);
 
             spriteBatch.End();